Kinetis SDK API Reference Manual  1.0.0-beta
Freescale Semiconductor, Inc.
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Groups Pages
fsl_sim_hal.h File Reference
#include <stdint.h>
#include <stdbool.h>
#include <assert.h>
#include "fsl_device_registers.h"
#include "fsl_sim_features.h"

Data Structures

struct  sim_clock_gate_module_config_t
 Clock gate module configuration table structure. More...
 
struct  sim_clock_source_value_t
 clock source value table structure More...
 
struct  sim_clock_name_config_t
 Clock name configuration table structure. More...
 

Enumerations

enum  sim_clock_names_t {
  kSimCoreClock,
  kSimSystemClock,
  kSimPlatformClock,
  kSimBusClock,
  kSimFlexBusClock,
  kSimFlashClock,
  kSimOsc32kClock,
  kSimOsc0ErClock,
  kSimOsc1ErClock,
  kSimIrc48mClock,
  kSimRtc32kClock,
  kSimRtc1hzClock,
  kSimLpoClock,
  kSimMcgFllClock,
  kSimMcgPll0Clock,
  kSimMcgPll1Clock,
  kSimMcgOutClock,
  kSimMcgIrClock,
  kSimSDHC0_CLKIN,
  kSimENET_1588_CLKIN,
  kSimEXTAL_Clock,
  kSimEXTAL1_Clock,
  kSimUSB_CLKIN,
  kSimReserved,
  kSimClockNameCount
}
 
enum  sim_clock_gate_module_names_t {
  kSimClockModuleDMA,
  kSimClockModuleDMAMUX,
  kSimClockModulePORT,
  kSimClockModuleMPU,
  kSimClockModuleLLWU,
  kSimClockModuleEWM,
  kSimClockModuleOSC1,
  kSimClockModuleFTF,
  kSimClockModuleNFC,
  kSimClockModuleFLEXBUS,
  kSimClockModuleDDR,
  kSimClockModuleCRC,
  kSimClockModuleRNGA,
  kSimClockModuleREGFILE,
  kSimClockModuleDRYICESECREG,
  kSimClockModuleDRYICE,
  kSimClockModuleADC,
  kSimClockModuleCMP,
  kSimClockModuleDAC,
  kSimClockModuleVREF,
  kSimClockModuleSAI,
  kSimClockModuleTPM,
  kSimClockModulePDB,
  kSimClockModuleFTM,
  kSimClockModulePIT,
  kSimClockModuleLPTIMER,
  kSimClockModuleCMT,
  kSimClockModuleRTC,
  kSimClockModuleENET,
  kSimClockModuleUSBHS,
  kSimClockModuleUSBFS,
  kSimClockModuleUSBDCD,
  kSimClockModuleFLEXCAN,
  kSimClockModuleSPI,
  kSimClockModuleI2C,
  kSimClockModuleUART,
  kSimClockModuleESDHC,
  kSimClockModuleLPUART,
  kSimClockModuleTSI,
  kSimClockModuleLCDC,
  kSimClockModuleMax
}
 Clock gate module names.
 
enum  sim_clock_source_names_t {
  kSimClockNfcSrc,
  kSimClockEsdhcSrc,
  kSimClockSdhcSrc,
  kSimClockLcdcSrc,
  kSimClockTimeSrc,
  kSimClockRmiiSrc,
  kSimClockUsbfSrc,
  kSimClockUsbSrc,
  kSimClockUsbhSrc,
  kSimClockUart0Src,
  kSimClockTpmSrc,
  kSimClockOsc32kSel,
  kSimClockUsbfSel,
  kSimClockPllfllSel,
  kSimClockNfcSel,
  kSimClockLcdcSel,
  kSimClockTraceSel,
  kSimClockClkoutSel,
  kSimClockRtcClkoutSel,
  kSimClockSourceMax
}
 Clock source and sel names.
 
enum  sim_clock_divider_names_t {
  kSimClockDividerOutdiv1,
  kSimClockDividerOutdiv2,
  kSimClockDividerOutdiv3,
  kSimClockDividerOutdiv4,
  kSimClockDividerUsbFrac,
  kSimClockDividerUsbDiv,
  kSimClockDividerUsbfsFrac,
  kSimClockDividerUsbfsDiv,
  kSimClockDividerUsbhsFrac,
  kSimClockDividerUsbhsDiv,
  kSimClockDividerLcdcFrac,
  kSimClockDividerLcdcDiv,
  kSimClockDividerNfcFrac,
  kSimClockDividerNfcDiv,
  kSimClockDividerSpecial1,
  kSimClockDividerMax
}
 Clock Divider names.
 
enum  sim_usbsstby_stop_t {
  kSimUsbsstbyNoRegulator,
  kSimUsbsstbyWithRegulator
}
 SIM USB voltage regulator in standby mode setting during stop modes.
 
enum  sim_usbvstby_stop_t {
  kSimUsbvstbyNoRegulator,
  kSimUsbvstbyWithRegulator
}
 SIM USB voltage regulator in standby mode setting during VLPR and VLPW modes.
 
enum  sim_cmtuartpad_strengh_t {
  kSimCmtuartSinglePad,
  kSimCmtuartDualPad
}
 SIM CMT/UART pad drive strength.
 
enum  sim_ptd7pad_strengh_t {
  kSimPtd7padSinglePad,
  kSimPtd7padDualPad
}
 SIM PTD7 pad drive strength.
 
enum  sim_flexbus_security_level_t {
  kSimFbslLevel0,
  kSimFbslLevel1,
  kSimFbslLevel2,
  kSimFbslLevel3
}
 SIM FlexBus security level.
 
enum  sim_pretrgsel_t {
  kSimAdcPretrgselA,
  kSimAdcPretrgselB
}
 SIM ADCx pre-trigger select.
 
enum  sim_trgsel_t {
  kSimAdcTrgselExt,
  kSimAdcTrgSelHighSpeedComp0,
  kSimAdcTrgSelHighSpeedComp1,
  kSimAdcTrgSelHighSpeedComp2,
  kSimAdcTrgSelPit0,
  kSimAdcTrgSelPit1,
  kSimAdcTrgSelPit2,
  kSimAdcTrgSelPit3,
  kSimAdcTrgSelFtm0,
  kSimAdcTrgSelFtm1,
  kSimAdcTrgSelFtm2,
  kSimAdcTrgSelFtm3,
  kSimAdcTrgSelRtcAlarm,
  kSimAdcTrgSelRtcSec,
  kSimAdcTrgSelLptimer,
  kSimAdcTrgSelHigSpeedComp3
}
 SIM ADCx trigger select.
 
enum  sim_uart_rxsrc_t {
  kSimUartRxsrcPin,
  kSimUartRxsrcCmp0,
  kSimUartRxsrcCmp1,
  kSimUartRxsrcReserved
}
 SIM receive data source select.
 
enum  sim_uart_txsrc_t {
  kSimUartTxsrcPin,
  kSimUartTxsrcCmp0,
  kSimUartTxsrcCmp1,
  kSimUartTxsrcReserved
}
 SIM transmit data source select.
 
enum  sim_ftm_trg_src_t {
  kSimFtmTrgSrc0,
  kSimFtmTrgSrc1
}
 SIM FlexTimer x trigger y select.
 
enum  sim_ftm_clk_sel_t {
  kSimFtmClkSel0,
  kSimFtmClkSel1
}
 SIM FlexTimer external clock select.
 
enum  sim_ftm_ch_src_t {
  kSimFtmChSrc0,
  kSimFtmChSrc1,
  kSimFtmChSrc2,
  kSimFtmChSrc3
}
 SIM FlexTimer x channel y input capture source select.
 
enum  sim_ftm_flt_sel_t {
  kSimFtmFltSel0,
  kSimFtmFltSel1
}
 SIM FlexTimer x Fault y select.
 
enum  sim_tpm_clk_sel_t {
  kSimTpmClkSel0,
  kSimTpmClkSel1
}
 SIM Timer/PWM external clock select.
 
enum  sim_tpm_ch_src_t {
  kSimTpmChSrc0,
  kSimTpmChSrc1
}
 SIM Timer/PWM x channel y input capture source select.
 
enum  sim_hal_status_t {
  kSimHalSuccess,
  kSimHalFail,
  kSimHalNoSuchModule,
  kSimHalNoSuchClockSrc,
  kSimHalNoSuchDivider
}
 SIM HAL API return status.
 

Functions

clock related feature APIs
sim_hal_status_t clock_hal_set_gate (sim_clock_gate_module_names_t clockModule, uint8_t instance, bool enable)
 Enables or disables the clock for a specified clock module. More...
 
sim_hal_status_t clock_hal_get_gate (sim_clock_gate_module_names_t clockModule, uint8_t instance, bool *isEnabled)
 Gets the clock enabled or disabled state. More...
 
sim_hal_status_t clock_hal_set_clock_source (sim_clock_source_names_t clockSource, uint8_t setting)
 Sets the clock source setting. More...
 
sim_hal_status_t clock_hal_get_clock_source (sim_clock_source_names_t clockSource, uint8_t *setting)
 Gets the clock source setting. More...
 
sim_hal_status_t clock_hal_set_clock_divider (sim_clock_divider_names_t clockDivider, uint32_t setting)
 Sets the clock divider setting. More...
 
void clock_hal_set_clock_out_dividers (uint32_t outdiv1, uint32_t outdiv2, uint32_t outdiv3, uint32_t outdiv4)
 Sets the clock out dividers setting. More...
 
sim_hal_status_t clock_hal_get_clock_divider (sim_clock_divider_names_t clockDivider, uint32_t *setting)
 Gets the clock divider setting. More...
 
individual field access APIs
static void sim_set_usbregen (bool enable)
 Sets the USB voltage regulator enabled setting. More...
 
static bool sim_get_usbregen (void)
 Gets the USB voltage regulator enabled setting. More...
 
static void sim_set_usbsstby (sim_usbsstby_stop_t setting)
 Sets the USB voltage regulator in a standby mode setting during Stop, VLPS, LLS, and VLLS. More...
 
static sim_usbsstby_stop_t sim_get_usbsstby (void)
 Gets the USB voltage regulator in a standby mode setting. More...
 
static void sim_set_usbvstby (sim_usbvstby_stop_t setting)
 Sets the USB voltage regulator in a standby mode during the VLPR or the VLPW. More...
 
static sim_usbvstby_stop_t sim_get_usbvstby (void)
 Gets the USB voltage regulator in a standby mode during the VLPR or the VLPW. More...
 
static void sim_set_usswe (bool enable)
 Sets the USB voltage regulator stop standby write enable setting. More...
 
static bool sim_get_usswe (void)
 Gets the USB voltage regulator stop standby write enable setting. More...
 
static void sim_set_uvswe (bool enable)
 Sets the USB voltage regulator VLP standby write enable setting. More...
 
static bool sim_get_uvswe (void)
 Gets the USB voltage regulator VLP standby write enable setting. More...
 
static void sim_set_urwe (bool enable)
 Sets the USB voltage regulator enable write enable setting. More...
 
static bool sim_get_urwe (void)
 Gets the USB voltage regulator enable write enable setting. More...
 
void sim_set_alttrgen (uint8_t instance, bool enable)
 Sets the ADCx alternate trigger enable setting. More...
 
bool sim_get_alttrgen (uint8_t instance)
 Gets the ADCx alternate trigger enable setting. More...
 
void sim_set_pretrgsel (uint8_t instance, sim_pretrgsel_t select)
 Sets the ADCx pre-trigger select setting. More...
 
sim_pretrgsel_t sim_get_pretrgsel (uint8_t instance)
 Gets the ADCx pre-trigger select setting. More...
 
void sim_set_trgsel (uint8_t instance, sim_trgsel_t select)
 Sets the ADCx trigger select setting. More...
 
sim_pretrgsel_t sims_get_trgsel (uint8_t instance)
 Gets the ADCx trigger select setting. More...
 
void sim_set_uart_rxsrc (uint8_t instance, sim_uart_rxsrc_t select)
 Sets the UARTx receive data source select setting. More...
 
sim_uart_rxsrc_t sim_get_uart_rxsrc (uint8_t instance)
 Gets the UARTx receive data source select setting. More...
 
void sim_set_uart_txsrc (uint8_t instance, sim_uart_txsrc_t select)
 Sets the UARTx transmit data source select setting. More...
 
sim_uart_txsrc_t sim_get_uart_txsrc (uint8_t instance)
 Gets the UARTx transmit data source select setting. More...
 
static uint32_t sim_get_fam_id (void)
 Gets the Kinetis Fam ID in System Device ID register (SIM_SDID). More...
 
static uint32_t sim_get_pin_id (void)
 Gets the Kinetis Pincount ID in System Device ID register (SIM_SDID). More...
 
static uint32_t sim_get_rev_id (void)
 Gets the Kinetis Revision ID in the System Device ID register (SIM_SDID). More...
 
static uint32_t sim_get_pf_size (void)
 Gets the program flash size in the Flash Configuration Register 1 (SIM_FCFG). More...
 

Variables

const sim_clock_name_config_t kSimClockNameConfigTable []
 clock name configuration table for specified CPU defined in fsl_clock_module_names_Kxxx.h
 
const
sim_clock_gate_module_config_t 
kSimClockGateModuleConfigTable []
 SIM configuration table for clock module names.
 
const sim_clock_source_value_tkClockSourceValueTable []
 clock source value table for specified CPU